/**
 * @Title: KaoQinController.java
 * @Package com.ruoyi.web.controller.kaoqin
 * @Description: 
 * Copyright: Copyright (c) 2019 www.codepeople.cn Inc. All rights reserved. 
 * Website: www.codepeople.cn
 * 注意：本内容仅限于海南科澜技术信息有限公司内部传阅，禁止外泄以及用于其他的商业目 
 * @Author 刘仁
 * @DateTime 2019年5月20日 下午4:42:12
 * @version V1.0
 */

package com.ruoyi.web.controller.supervise.examination.CompletionRecord;


import java.util.List;

import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.page.TableDataInfo;
import com.ruoyi.supervise.domain.CompletionRecordInfo;
import com.ruoyi.supervise.service.ICompletionRecordInfoService;

/**
 * @ClassName: ConstructionPermitController
 * @Description: 
 * @Author 吴挺杰
 * @DateTime 2019年11月11日 下午3:53:43
 */
@Controller
@RequestMapping("/supervise/completionRecordCertificate")
public class CompletionRecordCertificateController extends BaseController{

	private String prefix = "supervise/CompletionRecord/completionRecordCertificate";
	
	@Autowired
    private ICompletionRecordInfoService completionRecordInfoService;
	
	@RequiresPermissions("supervise:completionRecordCertificate:view")
	@GetMapping()
	public String completionRecordRecord()
	{
	    return prefix + "/completionRecordCertificate";
	}
	
	@PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(CompletionRecordInfo completionRecordInfo)
    {
        startPage();
        completionRecordInfo.setState("审批通过");
        List<CompletionRecordInfo> list = completionRecordInfoService.selectCompletionRecordInfoList(completionRecordInfo);
        for(CompletionRecordInfo c:list)
        {
        	if(c.getProjectinfoguid().equals("2"))
        	{
        		c.setProjectinfoguid("田德海泉湾A区");
        	}
        }
        return getDataTable(list);
    }
	 /**
      *  详情
     */
    @GetMapping("/detail/{engineeringname}")
    public String detail(@PathVariable("engineeringname") String engineeringname,ModelMap mmap)
    {
    	CompletionRecordInfo completionRecordInfo=new CompletionRecordInfo();
    	completionRecordInfo.setEngineeringname(engineeringname);
    	List<CompletionRecordInfo> completionRecordInfoList = completionRecordInfoService.selectCompletionRecordInfoList(completionRecordInfo);
    	mmap.put("completionRecordInfo", completionRecordInfoList.get(0));
        return prefix + "/detail";
    }
    /**
     *  编辑
    */
    @GetMapping("/edit/{engineeringname}")
    public String edit(@PathVariable("engineeringname") String engineeringname,ModelMap mmap)
    {
    	CompletionRecordInfo completionRecordInfo=new CompletionRecordInfo();
    	completionRecordInfo.setEngineeringname(engineeringname);
    	List<CompletionRecordInfo> completionRecordInfoList = completionRecordInfoService.selectCompletionRecordInfoList(completionRecordInfo);
    	mmap.put("completionRecordInfo", completionRecordInfoList.get(0));
        return prefix + "/edit";
    }
}
